<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小卓LayUI练习</title>
    <link rel="stylesheet" href="layui/css/layui.css"  media="all">
    <script src="layui/layui.js"></script>
    <script>
    let 弹出层 = (title, text)=>{
      layer.open({
        title,
        type: 1,
        offset: 'auto',
        id: 'LAY_demoauto',
        content: '<div style="padding: 20px 100px;">'+ text +'</div>',
        btn: '关闭',
        btnAlign: 'c',
        shade: 0,
        yes(){
        layer.closeAll();
        }
      });
    };
    let msgbox = ()=>{
      layer.open({
        title: titles.value,
        content: contents.value
      });
    };
    //弹出层('这里是标题', contents.value);
    </script>
</head>
<body>
    标题：<input id="titles" type="text" /><br/>
    内容：<input id="contents" type="text" /><br/>
    <button onclick="msgbox()">显示对话框</button>
</body>
</html>